//////////////////////////////////////////////////////////////////////////

#ifndef _THEME_H_
#include "theme.h"
#endif

//////////////////////////////////////////////////////////////////////////



std::string GUI_Theme::m_ResourcesFolder = "";
float GUI_Theme::m_ResizeFactor = 0;
GUI_Fonts *GUI_Theme::m_Fonts = 0;
GUI_Colors *GUI_Theme::m_Colors = 0;
GUI_Images *GUI_Theme::m_Images = 0;
GUI_Sounds *GUI_Theme::m_Sounds = 0;


//////////////////////////////////////////////////////////////////////////


void GUI_Theme::Reload(const std::string& _resourcesFolder, float _resizeFactor)
{
    m_ResourcesFolder = _resourcesFolder;
    m_ResizeFactor = _resizeFactor;
    if (m_Fonts) delete m_Fonts;
    m_Fonts = new GUI_Fonts(m_ResourcesFolder, m_ResizeFactor);

    if (m_Colors) delete m_Colors;
    m_Colors = new GUI_Colors();

    if (m_Images) delete m_Images;
    m_Images = new GUI_Images(m_ResourcesFolder, m_ResizeFactor);

    if (m_Sounds) delete m_Sounds;
    m_Sounds = new GUI_Sounds(m_ResourcesFolder);

}


//////////////////////////////////////////////////////////////////////////


void GUI_Theme::Release()
{
    if (m_Fonts) delete m_Fonts;
    if (m_Colors) delete m_Colors;
    if (m_Images) delete m_Images;
    if (m_Sounds) delete m_Sounds;
}


//////////////////////////////////////////////////////////////////////////


void GUI_Theme::Resize(float _resizeFactor)
{
    if (m_ResizeFactor != _resizeFactor)
    {
        m_ResizeFactor = _resizeFactor;
        m_Fonts->Resize(m_ResizeFactor);
        m_Images->Resize(m_ResizeFactor);
    }
}


//////////////////////////////////////////////////////////////////////////


void GUI_Theme::ReloadMapImages(const std::string& _mapFolder)
{
    m_Images->ReloadMapImages(_mapFolder);
}


//////////////////////////////////////////////////////////////////////////


float GUI_Theme::GetResizeFactor()
{
    return m_ResizeFactor;
}


//////////////////////////////////////////////////////////////////////////


Mix_Chunk *GUI_Theme::GetSound(GUI_Sounds::Sound _soundName)
{
    return m_Sounds->GetSound(_soundName);
}


//////////////////////////////////////////////////////////////////////////


Mix_Music *GUI_Theme::GetMusic(GUI_Sounds::Music _musicName)
{
    return m_Sounds->GetMusic(_musicName);
}


//////////////////////////////////////////////////////////////////////////


TTF_Font *GUI_Theme::Font(GUI_Fonts::Font _fontName)
{
    return m_Fonts->Get(_fontName);
}


//////////////////////////////////////////////////////////////////////////


SDL_Color &GUI_Theme::Color(GUI_Colors::Color _colorName)
{
    return m_Colors->Get(_colorName);
}


//////////////////////////////////////////////////////////////////////////


SDL_Surface *GUI_Theme::Image(GUI_Images::Image _imageName)
{
    return m_Images->Get(_imageName);
}


//////////////////////////////////////////////////////////////////////////
